package com.ruoyi.mobile.service;

import com.ruoyi.db.system.domain.SysRegion;
import com.ruoyi.mobile.project.ums.service.WxUmsRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zhy
 * @date 2019-01-17 23:07
 **/
@Component
public class GetRegionService
{

    private static List<SysRegion> wxUmsRegions;
    @Autowired
    private WxUmsRegionService regionService;

    protected List<SysRegion> getLitemallRegions()
    {
        if (wxUmsRegions == null)
        {
            createRegion();
        }
        return wxUmsRegions;
    }

    private synchronized void createRegion()
    {
        if (wxUmsRegions == null)
        {
            wxUmsRegions = regionService.getAll();
        }
    }
}
